//
//  ByApiRecord.m
//  recordworktool_ios
//
//  Created by mc on 2017/12/28.
//  Copyright © 2017年 ZhangZhanbin. All rights reserved.
//

#import "ByApiRecord.h"

@implementation ByApiRecord

+ (void)recordLogWorkShift:(ByNetModel *)model
                   success:(void(^)(ByNetBaseResult *result))success
                   failure:(void(^)(ByNetBaseResult *result))failure{
    
    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
    
    if (model.record_uid) {
        [dictionary setObject:model.record_uid forKey:@"record_uid"];
    }
    
    if (model.user_mobile) {
        [dictionary setObject:model.user_mobile forKey:@"user_mobile"];
    }
    
    if (model.nickname) {
        [dictionary setObject:model.nickname forKey:@"nickname"];
    }
    
    if (model.project_title) {
        [dictionary setObject:model.project_title forKey:@"project_title"];
    }
    
    if (model.hourly_wage) {
        [dictionary setObject:model.hourly_wage forKey:@"hourly_wage"];
    }
    
    if (model.daytime) {
        [dictionary setObject:model.daytime forKey:@"daytime"];
    }
    
    if (model.normal_work_time) {
        [dictionary setObject:model.normal_work_time forKey:@"normal_work_time"];
    }
    
    if (model.overtime) {
        [dictionary setObject:model.overtime forKey:@"overtime"];
    }
    
    if (model.note) {
        [dictionary setObject:model.note forKey:@"note"];
    }
    

    static NSString *apiType = @"By_JgbRecord_logWorkShift";
    static NSInteger apiVersion = 100;
    int rand = arc4random() % 1000;
    NSString *requestId = [NSString stringWithFormat:@"%ld%d", (NSInteger)[NSDate currentDateTimeInterval], rand];
    
    
    [self post:requestId
       apiType:apiType
      dataType:ByNetDataTypeString
     apiVerson:apiVersion
        params:dictionary
       success:^(NSURLSessionDataTask *operation, id responseObject, NSString *notifyID) {
           
           
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = 0;
           result.msg = @"添加成功";
           result.data = responseObject;
           result.notify_id = notifyID;
           if(success){
               success(result);
           }
           
       } failure:^(NSURLSessionDataTask *operation, NSError *error){
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = error.code;
           result.msg = error.domain;
           result.data = error.localizedDescription;
           if(failure){
               failure(result);
           } else {
               [ByCoreToolAlert showFailureWithText:result.msg];
           }
           
       }];
    
}

//记录包工项目
+ (void)recordLogSubWork:(ByNetModel *)model
                 success:(void(^)(ByNetBaseResult *result))success
                 failure:(void(^)(ByNetBaseResult *result))failure{
    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
    
    if (model.record_uid) {
        [dictionary setObject:model.record_uid forKey:@"record_uid"];
    }
    
    if (model.user_mobile) {
        [dictionary setObject:model.user_mobile forKey:@"user_mobile"];
    }
    
    if (model.nickname) {
        [dictionary setObject:model.nickname forKey:@"nickname"];
    }
    
    if (model.project_title) {
        [dictionary setObject:model.project_title forKey:@"project_title"];
    }
    
    if (model.sub_project_title) {
        [dictionary setObject:model.sub_project_title forKey:@"sub_project_title"];
    }
    
    if (model.daytime) {
        [dictionary setObject:model.daytime forKey:@"daytime"];
    }
    
    if (model.count) {
        [dictionary setObject:model.count forKey:@"count"];
    }
    
    if (model.price) {
        [dictionary setObject:model.price forKey:@"price"];
    }
    
    if (model.note) {
        [dictionary setObject:model.note forKey:@"note"];
    }
    
    
    static NSString *apiType = @"By_JgbRecord_logSubWork";
    static NSInteger apiVersion = 100;
    int rand = arc4random() % 1000;
    NSString *requestId = [NSString stringWithFormat:@"%ld%d", (NSInteger)[NSDate currentDateTimeInterval], rand];
    
    
    [self post:requestId
       apiType:apiType
      dataType:ByNetDataTypeString
     apiVerson:apiVersion
        params:dictionary
       success:^(NSURLSessionDataTask *operation, id responseObject, NSString *notifyID) {
           
           
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = 0;
           result.msg = @"添加成功";
           result.data = responseObject;
           result.notify_id = notifyID;
           if(success){
               success(result);
           }
           
       } failure:^(NSURLSessionDataTask *operation, NSError *error){
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = error.code;
           result.msg = error.domain;
           result.data = error.localizedDescription;
           if(failure){
               failure(result);
           } else {
               [ByCoreToolAlert showFailureWithText:result.msg];
           }
           
       }];
    
    
    
    
}


//借出、结算记录添加
+ (void)recordLogMoney:(ByNetModel *)model
               success:(void(^)(ByNetBaseResult *result))success
               failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
    
    if (model.record_uid) {
        [dictionary setObject:model.record_uid forKey:@"record_uid"];
    }
    
    if (model.user_mobile) {
        [dictionary setObject:model.user_mobile forKey:@"user_mobile"];
    }
    
    if (model.nickname) {
        [dictionary setObject:model.nickname forKey:@"nickname"];
    }
    
    if (model.project_title) {
        [dictionary setObject:model.project_title forKey:@"project_title"];
    }
    
    if (model.type) {
        [dictionary setObject:model.type forKey:@"tpye"];
    }
    
    if (model.daytime) {
        [dictionary setObject:model.daytime forKey:@"daytime"];
    }
    
    if (model.money) {
        [dictionary setObject:model.money forKey:@"money"];
    }
    if (model.note) {
        [dictionary setObject:model.note forKey:@"note"];
    }
    
    
   
    
    
    static NSString *apiType = @"By_JgbRecord_logMoney";
    static NSInteger apiVersion = 100;
    int rand = arc4random() % 1000;
    NSString *requestId = [NSString stringWithFormat:@"%ld%d", (NSInteger)[NSDate currentDateTimeInterval], rand];
    
    
    [self post:requestId
       apiType:apiType
      dataType:ByNetDataTypeString
     apiVerson:apiVersion
        params:dictionary
       success:^(NSURLSessionDataTask *operation, id responseObject, NSString *notifyID) {
           
           
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = 0;
           result.msg = @"添加成功";
           result.data = responseObject;
           result.notify_id = notifyID;
           if(success){
               success(result);
           }
           
       } failure:^(NSURLSessionDataTask *operation, NSError *error){
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = error.code;
           result.msg = error.domain;
           result.data = error.localizedDescription;
           if(failure){
               failure(result);
           } else {
               [ByCoreToolAlert showFailureWithText:result.msg];
           }
           
       }];
    
    
    
}


//工头端-审核记录查询接口
+ (void)queryAuditRecordForOverseer:(ByNetModel *)model
                            success:(void(^)(ByNetBaseResult *result))success
                            failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
    
    if (model.uid) {
        [dictionary setObject:model.uid forKey:@"uid"];
    }
    
    if (model.mobile) {
        [dictionary setObject:model.mobile forKey:@"mobile"];
    }
    
    [dictionary setObject:@"1" forKey:@"page_index"];
    [dictionary setObject:@"1000" forKey:@"page_size"];
    
    static NSString *apiType = @"By_JgbRecord_queryAuditRecordForOverseer";
    static NSInteger apiVersion = 100;
    int rand = arc4random() % 1000;
    NSString *requestId = [NSString stringWithFormat:@"%ld%d", (NSInteger)[NSDate currentDateTimeInterval], rand];
    
    [self post:requestId
       apiType:apiType
      dataType:ByNetDataTypeDictionary
     apiVerson:apiVersion
        params:dictionary
       success:^(NSURLSessionDataTask *operation, id responseObject, NSString *notifyID) {
           
           NSLog(@"工头端审核记录查询接口 =%@", responseObject);
           NSMutableArray *dataArray = [NSMutableArray arrayWithCapacity:1];
           for (NSDictionary *dic in responseObject[@"list"]) {
               ByNetModel *netModel = [[ByNetModel alloc] initContentWithDic:dic];
               [dataArray addObject:netModel];
           }
           
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = 0;
           result.msg = @"添加成功";
           result.data = dataArray;
           result.notify_id = notifyID;
           if(success){
               success(result);
           }
           
       } failure:^(NSURLSessionDataTask *operation, NSError *error){
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = error.code;
           result.msg = error.domain;
           result.data = error.localizedDescription;
           if(failure){
               failure(result);
           } else {
               [ByCoreToolAlert showFailureWithText:result.msg];
           }
           
       }];
    
    
}


+ (void)queryAuditRecordForWorker:(ByNetModel *)model
                          success:(void(^)(ByNetBaseResult *result))success
                          failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
    
    if (model.uid) {
        [dictionary setObject:model.uid forKey:@"uid"];
    }
    
    if (model.mobile) {
        [dictionary setObject:model.mobile forKey:@"mobile"];
    }
    
    [dictionary setObject:@"1" forKey:@"page_index"];
    [dictionary setObject:@"1000" forKey:@"page_size"];
    
    static NSString *apiType = @"By_JgbRecord_queryAuditRecordForWorker";
    static NSInteger apiVersion = 100;
    int rand = arc4random() % 1000;
    NSString *requestId = [NSString stringWithFormat:@"%ld%d", (NSInteger)[NSDate currentDateTimeInterval], rand];
    
    [self post:requestId
       apiType:apiType
      dataType:ByNetDataTypeDictionary
     apiVerson:apiVersion
        params:dictionary
       success:^(NSURLSessionDataTask *operation, id responseObject, NSString *notifyID) {
           
           NSLog(@"工人端审核记录查询接口 = %@", responseObject);
           NSMutableArray *dataArray = [NSMutableArray arrayWithCapacity:1];
           for (NSDictionary *dic in responseObject[@"list"]) {
               ByNetModel *netModel = [[ByNetModel alloc] initContentWithDic:dic];
               [dataArray addObject:netModel];
           }
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = 0;
           result.msg = @"添加成功";
           result.data = dataArray;
           result.notify_id = notifyID;
           if(success){
               success(result);
           }
           
       } failure:^(NSURLSessionDataTask *operation, NSError *error){
           NSLog(@"error = %@", error);
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = error.code;
           result.msg = error.domain;
           result.data = error.localizedDescription;
           if(failure){
               failure(result);
           } else {
               [ByCoreToolAlert showFailureWithText:result.msg];
           }
           
       }];
    
    
    
}


//记录审核接口
+ (void)audit:(ByNetModel *)model
      success:(void(^)(ByNetBaseResult *result))success
      failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
    
    if (model.ID) {
        [dictionary setObject:model.ID forKey:@"id"];
    }
    
    if (model.operator_uid) {
        [dictionary setObject:model.operator_uid forKey:@"operator_uid"];
    }
    
    if (model.audit_status) {
        [dictionary setObject:model.audit_status forKey:@"audit_status"];
    }
    
    static NSString *apiType = @"By_JgbRecord_audit";
    static NSInteger apiVersion = 100;
    int rand = arc4random() % 1000;
    NSString *requestId = [NSString stringWithFormat:@"%ld%d", (NSInteger)[NSDate currentDateTimeInterval], rand];
    
    [self post:requestId
       apiType:apiType
      dataType:ByNetDataTypeArray
     apiVerson:apiVersion
        params:dictionary
       success:^(NSURLSessionDataTask *operation, id responseObject, NSString *notifyID) {
           
           NSLog(@"%@", responseObject);
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = 0;
           result.msg = @"添加成功";
           result.data = responseObject;
           result.notify_id = notifyID;
           if(success){
               success(result);
           }
           
       } failure:^(NSURLSessionDataTask *operation, NSError *error){
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = error.code;
           result.msg = error.domain;
           result.data = error.localizedDescription;
           if(failure){
               failure(result);
           } else {
               [ByCoreToolAlert showFailureWithText:result.msg];
           }
           
       }];
    
    
}

//工人财务统计查询接口
+ (void)financeBillWorker:(ByNetModel *)model
                  success:(void(^)(ByNetBaseResult *result))success
                  failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
    if (model.mobile) {
        [dictionary setObject:model.mobile forKey:@"mobile"];
    }

    static NSString *apiType = @"By_JgbFinanceBill_worker";
    static NSInteger apiVersion = 101;
    int rand = arc4random() % 1000;
    NSString *requestId = [NSString stringWithFormat:@"%ld%d", (NSInteger)[NSDate currentDateTimeInterval], rand];
    
    [self post:requestId
       apiType:apiType
      dataType:ByNetDataTypeDictionary
     apiVerson:apiVersion
        params:dictionary
       success:^(NSURLSessionDataTask *operation, id responseObject, NSString *notifyID) {
           
           NSLog(@"工人财务统计查询接口 = %@", responseObject);
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = 0;
           result.msg = @"添加成功";
           result.data = responseObject;
           result.notify_id = notifyID;
           if(success){
               success(result);
           }
           
       } failure:^(NSURLSessionDataTask *operation, NSError *error){
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = error.code;
           result.msg = error.domain;
           result.data = error.localizedDescription;
           if(failure){
               failure(result);
           } else {
               [ByCoreToolAlert showFailureWithText:result.msg];
           }
           
       }];
    
    
}

+ (void)financeBillOverseer:(ByNetModel *)model
                    success:(void(^)(ByNetBaseResult *result))success
                    failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
    if (model.mobile) {
        [dictionary setObject:model.mobile forKey:@"mobile"];
    }
    
    static NSString *apiType = @"By_JgbFinanceBill_overseer";
    static NSInteger apiVersion = 101;
    int rand = arc4random() % 1000;
    NSString *requestId = [NSString stringWithFormat:@"%ld%d", (NSInteger)[NSDate currentDateTimeInterval], rand];
    
    [self post:requestId
       apiType:apiType
      dataType:ByNetDataTypeDictionary
     apiVerson:apiVersion
        params:dictionary
       success:^(NSURLSessionDataTask *operation, id responseObject, NSString *notifyID) {
           
           NSLog(@"工头财务统计查询接口 = %@", responseObject);
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = 0;
           result.msg = @"添加成功";
           result.data = responseObject;
           result.notify_id = notifyID;
           if(success){
               success(result);
           }
           
       } failure:^(NSURLSessionDataTask *operation, NSError *error){
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = error.code;
           result.msg = error.domain;
           result.data = error.localizedDescription;
           if(failure){
               failure(result);
           } else {
               [ByCoreToolAlert showFailureWithText:result.msg];
           }
           
       }];
    
    
    
}

//工人记工、工资清单查询接口
+ (void)queryWorker:(ByNetModel *)model
            success:(void(^)(ByNetBaseResult *result))success
            failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    
    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
    
    if (model.name) {
        [dictionary setObject:model.name forKey:@"name"];
    }
    
    if (model.project_title) {
        [dictionary setObject:model.project_title forKey:@"project_title"];
    }
    
    if (model.mobile) {
        [dictionary setObject:model.mobile forKey:@"mobile"];
    }
    if (model.daytime) {
        [dictionary setObject:model.daytime forKey:@"daytime"];
        
    }
    NSLog(@"mobile = %@,time = %@", model.mobile,model.daytime);
    
    [dictionary setObject:@"1" forKey:@"page_index"];
    [dictionary setObject:@"1000" forKey:@"page_size"];
    
    static NSString *apiType = @"By_JgbRecord_queryWorker";
    static NSInteger apiVersion = 100;
    int rand = arc4random() % 1000;
    NSString *requestId = [NSString stringWithFormat:@"%ld%d", (NSInteger)[NSDate currentDateTimeInterval], rand];
    
    [self post:requestId
       apiType:apiType
      dataType:ByNetDataTypeDictionary
     apiVerson:apiVersion
        params:dictionary
       success:^(NSURLSessionDataTask *operation, id responseObject, NSString *notifyID) {
           NSMutableArray *tempArray = [NSMutableArray arrayWithCapacity:1];
           for (NSDictionary *dic in responseObject[@"list"]) {
               ByNetModel *netModel = [[ByNetModel alloc] initContentWithDic:dic];
               [tempArray addObject:netModel];
           }
           NSLog(@"工人记工 = %@", responseObject);
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = 0;
           result.msg = @"添加成功";
           result.data = tempArray;
           result.notify_id = notifyID;
           if(success){
               success(result);
           }
           
       } failure:^(NSURLSessionDataTask *operation, NSError *error){
           NSLog(@"工人记工 error = %@",error);
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = error.code;
           result.msg = error.domain;
           result.data = error.localizedDescription;
           if(failure){
               failure(result);
           } else {
               [ByCoreToolAlert showFailureWithText:result.msg];
           }
           
       }];
    
}

//工头记工、工资查询接口
+ (void)queryOverseer:(ByNetModel *)model
              success:(void(^)(ByNetBaseResult *result))success
              failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
    
    if (model.name){
        [dictionary setObject:model.name forKey:@"name"];
    }
    
    if (model.project_title) {
        [dictionary setObject:model.project_title forKey:@"project_title"];
    }
    
    if (model.mobile) {
        [dictionary setObject:model.mobile forKey:@"mobile"];
    }
    
    if (model.daytime) {
        [dictionary setObject:model.daytime forKey:@"daytime"];
        
    }
    
    
    [dictionary setObject:@"1" forKey:@"page_index"];
    [dictionary setObject:@"1000" forKey:@"page_size"];
    
    NSLog(@"daytime 查询时间 = %@", model.daytime);
    
    static NSString *apiType = @"By_JgbRecord_queryOverseer";
    static NSInteger apiVersion = 100;
    int rand = arc4random() % 1000;
    NSString *requestId = [NSString stringWithFormat:@"%ld%d", (NSInteger)[NSDate currentDateTimeInterval], rand];
    
    [self post:requestId
       apiType:apiType
      dataType:ByNetDataTypeDictionary
     apiVerson:apiVersion
        params:dictionary
       success:^(NSURLSessionDataTask *operation, id responseObject, NSString *notifyID) {
           
           NSLog(@"工头记工 = %@", responseObject);
           NSMutableArray *tempArray = [NSMutableArray arrayWithCapacity:1];
           for (NSDictionary *dic in responseObject[@"list"]) {
               ByNetModel *netModel = [[ByNetModel alloc] initContentWithDic:dic];
               [tempArray addObject:netModel];
           }
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = 0;
           result.msg = @"添加成功";
           result.data = tempArray;
           result.notify_id = notifyID;
           if(success){
               success(result);
           }
           
       } failure:^(NSURLSessionDataTask *operation, NSError *error){
           NSLog(@"工头记工 error = %@", error);
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = error.code;
           result.msg = error.domain;
           result.data = error.localizedDescription;
           if(failure){
               failure(result);
           } else {
               [ByCoreToolAlert showFailureWithText:result.msg];
           }
           
       }];
    
}


+ (void)info:(ByNetModel *)model
     success:(void(^)(ByNetBaseResult *result))success
     failure:(void(^)(ByNetBaseResult *result))failure{
    
    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
    
    if (model.ID) {
        [dictionary setObject:model.ID forKey:@"id"];
    }
    
    static NSString *apiType = @"By_JgbRecord_info";
    static NSInteger apiVersion = 100;
    int rand = arc4random() % 1000;
    NSString *requestId = [NSString stringWithFormat:@"%ld%d", (NSInteger)[NSDate currentDateTimeInterval], rand];
    
    [self post:requestId
       apiType:apiType
      dataType:ByNetDataTypeArray
     apiVerson:apiVersion
        params:dictionary
       success:^(NSURLSessionDataTask *operation, id responseObject, NSString *notifyID) {
           
           NSLog(@"%@", responseObject);
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = 0;
           result.msg = @"添加成功";
           result.data = responseObject;
           result.notify_id = notifyID;
           if(success){
               success(result);
           }
           
       } failure:^(NSURLSessionDataTask *operation, NSError *error){
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = error.code;
           result.msg = error.domain;
           result.data = error.localizedDescription;
           if(failure){
               failure(result);
           } else {
               [ByCoreToolAlert showFailureWithText:result.msg];
           }
           
       }];
    
    
}


//记录更新接口
+ (void)update:(ByNetModel *)model
       success:(void(^)(ByNetBaseResult *result))success
       failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
    
    if (model.operator_uid) {
        [dictionary setObject:model.operator_uid forKey:@"operator_uid"];
    }
    
    if (model.ID) {
        [dictionary setObject:model.ID forKey:@"id"];
    }
    
    if (model.item_type_key) {
        [dictionary setObject:model.item_type_key forKey:@"item_type_key"];
    }
    
    if (model.worker_mobile) {
        [dictionary setObject:model.worker_mobile forKey:@"worker_mobile"];
    }
    
    if (model.worker_name) {
        [dictionary setObject:model.worker_name forKey:@"worker_name"];
    }
    
    if (model.overseer_mobile) {
        [dictionary setObject:model.overseer_mobile forKey:@"overseer_mobile"];
    }
    
    if (model.overseer_name) {
        [dictionary setObject:model.overseer_name forKey:@"overseer_name"];
    }
    
    if (model.project_title) {
        [dictionary setObject:model.project_title forKey:@"project_title"];
    }
    
    if (model.sub_title) {
        [dictionary setObject:model.sub_title forKey:@"sub_title"];
    }
    
    if (model.daytime) {
        [dictionary setObject:model.daytime forKey:@"daytime"];
    }
    
    if (model.count) {
        [dictionary setObject:model.count forKey:@"count"];
    }
    
    if (model.price) {
        [dictionary setObject:[NSString stringWithFormat:@"%f",model.price.floatValue * 100] forKey:@"price"];
    }
    
    if (model.note) {
        [dictionary setObject:model.note forKey:@"note"];
    }
    
    if (model.hourly_wage) {
        [dictionary setObject:[NSString stringWithFormat:@"%f",model.hourly_wage.floatValue * 100] forKey:@"hourly_wage"];
    }
    
    if (model.normal_worktime) {
        [dictionary setObject:model.normal_worktime forKey:@"normal_worktime"];
    }
    if (model.over_worktime) {
        [dictionary setObject:model.over_worktime forKey:@"over_worktime"];
    }
    
    if (model.money) {
        [dictionary setObject:[NSString stringWithFormat:@"%f", model.money.floatValue * 100] forKey:@"money"];
    }
    
    static NSString *apiType = @"By_JgbRecord_update";
    static NSInteger apiVersion = 100;
    int rand = arc4random() % 1000;
    NSString *requestId = [NSString stringWithFormat:@"%ld%d", (NSInteger)[NSDate currentDateTimeInterval], rand];
    
    
    [self post:requestId
       apiType:apiType
      dataType:ByNetDataTypeString
     apiVerson:apiVersion
        params:dictionary
       success:^(NSURLSessionDataTask *operation, id responseObject, NSString *notifyID) {
           
           
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = 0;
           result.msg = @"添加成功";
           result.data = responseObject;
           result.notify_id = notifyID;
           if(success){
               success(result);
           }
           
       } failure:^(NSURLSessionDataTask *operation, NSError *error){
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = error.code;
           result.msg = error.domain;
           result.data = error.localizedDescription;
           if(failure){
               failure(result);
           } else {
               [ByCoreToolAlert showFailureWithText:result.msg];
           }
           
       }];
    
    
    
    
}


//记录添加接口
+ (void)add:(ByNetModel *)model
    success:(void(^)(ByNetBaseResult *result))success
    failure:(void(^)(ByNetBaseResult *result))failure{
    
    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
    
    if (model.record_uid) {
        [dictionary setObject:model.record_uid forKey:@"record_uid"];
    }
    
    if (model.item_type_key) {
        [dictionary setObject:model.item_type_key forKey:@"item_type_key"];
    }
    
    if (model.worker_mobile) {
        [dictionary setObject:model.worker_mobile forKey:@"worker_mobile"];
    }
    
    if (model.worker_name) {
        [dictionary setObject:model.worker_name forKey:@"worker_name"];
    }
    
    if (model.overseer_mobile) {
        [dictionary setObject:model.overseer_mobile forKey:@"overseer_mobile"];
    }
    
    if (model.overseer_name) {
        [dictionary setObject:model.overseer_name forKey:@"overseer_name"];
    }
    
    if (model.project_title) {
        [dictionary setObject:model.project_title forKey:@"project_title"];
    }
    
    if (model.sub_title) {
        [dictionary setObject:model.sub_title forKey:@"sub_title"];
    }
    
    if (model.daytime) {
        [dictionary setObject:model.daytime forKey:@"daytime"];
    }
    
    if (model.count) {
        [dictionary setObject:model.count forKey:@"count"];
    }
    
    if (model.price) {
        [dictionary setObject:[NSString stringWithFormat:@"%f",model.price.floatValue * 100] forKey:@"price"];
    }
    
    if (model.note) {
        [dictionary setObject:model.note forKey:@"note"];
    }
    
    if (model.hourly_wage) {
        [dictionary setObject:[NSString stringWithFormat:@"%f",model.hourly_wage.floatValue * 100] forKey:@"hourly_wage"];
    }
    
    if (model.normal_worktime) {
        [dictionary setObject:model.normal_worktime forKey:@"normal_worktime"];
    }
    if (model.over_worktime) {
        [dictionary setObject:model.over_worktime forKey:@"over_worktime"];
    }
    
    if (model.money) {
        [dictionary setObject:[NSString stringWithFormat:@"%f", model.money.floatValue * 100] forKey:@"money"];
    }
    
    static NSString *apiType = @"By_JgbRecord_add";
    static NSInteger apiVersion = 100;
    int rand = arc4random() % 1000;
    NSString *requestId = [NSString stringWithFormat:@"%ld%d", (NSInteger)[NSDate currentDateTimeInterval], rand];
    
    
    [self post:requestId
       apiType:apiType
      dataType:ByNetDataTypeString
     apiVerson:apiVersion
        params:dictionary
       success:^(NSURLSessionDataTask *operation, id responseObject, NSString *notifyID) {
           
           
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = 0;
           result.msg = @"添加成功";
           result.data = responseObject;
           result.notify_id = notifyID;
           if(success){
               success(result);
           }
           
       } failure:^(NSURLSessionDataTask *operation, NSError *error){
           
           ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
           result.code = error.code;
           result.msg = error.domain;
           result.data = error.localizedDescription;
           if(failure){
               failure(result);
           } else {
               [ByCoreToolAlert showFailureWithText:result.msg];
           }
           
       }];
    
    
    
    
}



@end
